package com.kl.feign;

import com.kl.domain.LogisticsStoreDTO;
import com.kl.domain.StaffWarehouseDTO;
import com.kl.em.Result;
import com.kl.feign.fallback.LogisticsStoreControllerFeignFallback;
import com.kl.feign.fallback.UserServiceFeignFallback;
import com.kl.feign.fallback.LogisticsStoreControllerFeignFallback;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "kunlun-logistics-store-service-b",fallback = LogisticsStoreControllerFeignFallback.class)//服务名找项目
public interface LogisticsStoreControllerFeign {

//站点 管理 接口

    //根据ID进行查询
    @GetMapping("/logistics-store/selectLogisticsStoreById/{id}")
    Result<LogisticsStoreDTO> selectLogisticsStoreById(@PathVariable Long id);

    //查询所有站点
    @GetMapping("/logistics-store/selectLogisticsStoreAll")
    Result<List<LogisticsStoreDTO>> selectLogisticsStoreAll();

    //站点模糊查询
    @GetMapping("/logistics-store/selectByCityName")
    Result<List<LogisticsStoreDTO>> selectByCityName(@RequestParam("cityName") String cityName);

    //站点增加
    @PostMapping("/logistics-store/saveLogisticsStore")
    Result saveLogisticsStore(@RequestBody LogisticsStoreDTO logisticsStoreDTO);

    //站点修改
    @PutMapping("/logistics-store/updateLogisticsStore/{id}")
    Result updateLogisticsStore(@PathVariable Long id, @RequestBody LogisticsStoreDTO logisticsStoreDTO);

    //站点删除
    @DeleteMapping("/logistics-store/deleteLogisticsStore")
    Result deleteLogisticsStore(@RequestBody Long[] id );

    //站点模糊查询分页
    //            name="pageNumber",value = "起始页数", 分页
    //            name="pageSize",value = "每页条数",   分页
    //            name="storeAddr",value = "网点地址",  模糊
    //            name="storeName",value = "网点名称",  模糊
    //            name="business",value = "网点业务(发货 快递派送 快递自提) eq
    //            name="ifWarehouse",value = "是否是物流仓库" 判断 eq
    @GetMapping("/logistics-store/selectLogisticsStoreLikePage")
    Result<Map<String,Object>> selectLogisticsStoreLikePage(@RequestParam(defaultValue = "1")Integer pageNumber,
                                                            @RequestParam(defaultValue = "3")Integer pageSize,
                                                            @RequestParam(required = false)String storeAddr,
                                                            @RequestParam(required = false)String storeName,
                                                            @RequestParam(required = false)String business,
                                                            @RequestParam(required = false)Integer ifWarehouse);

    //站点授权(开通/关闭授权)
    //name="id",value = "实体类的ID(或数组)
    //name="SiteRole",value = "授权与否的标识", 1已授权,2权限收回
    @PutMapping("/logistics-store/updateLogisticsStoreBySiteRole/{SiteRole}")
    Result updateLogisticsStoreBySiteRole(@RequestBody Long[] id,@PathVariable Integer SiteRole);


    //以下 : 站点 仓库 管理

    //根据仓库ID进行查询
    @GetMapping("selectStaffWarehouseById/{id}")
    Result<StaffWarehouseDTO> selectStaffWarehouseById(@PathVariable Long id);

    //根据站点ID进行查询
    @GetMapping("/staff-warehouse/selectStaffWarehouseByLogisticsStoreId/{id}")
    Result<List<StaffWarehouseDTO>> selectStaffWarehouseByLogisticsStoreId(@PathVariable Long id);

    //站点仓库增加
    @PostMapping("saveStaffWarehouse")
    Result saveStaffWarehouse(@RequestBody StaffWarehouseDTO staffWarehouseDTO);

    //站点仓库修改(包括修改仓库状态)
    @PutMapping("updateStaffWarehouse/{id}")
    Result updateStaffWarehouse(@PathVariable Long id,@RequestBody StaffWarehouseDTO staffWarehouseDTO,@RequestParam(required = false) Integer warehouseStatus);

    //站点仓库删除(物理删除)
    @DeleteMapping("deleteStaffWarehouse")
    Result deleteStaffWarehouse(@RequestBody Long[] id);

    //kl增加的,站点仓库查询所有
    @GetMapping("/list")
    Result<List<StaffWarehouseDTO>> selectStaffWarehouseToList();

    //站点城市id查询接口
    @PutMapping("/logistics-store/selectByCityId")
    Result<List<LogisticsStoreDTO>> selectByCityId(@RequestParam("cityId")String cityId);

}
